package com.demo.example.hot100;
public class TheMaxStorage{
    public static int maxArea(int[] height){
        int left=0;
        int right=height.length-1;
        int res=Integer.MIN_VALUE;
        while(left<=right){
            int length=right-left;
            int wide=Math.min(height[left],height[right]);
            int area=wide*length;
            res=area>res?area:res;
            if(height[left]<=height[right]){
                left++;
            }else{
                right--;
            }
        }
        return res;
    }
}